package api

import (
	"ecommerce-customer-support-chat/api/handler"
	"ecommerce-customer-support-chat/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func LoadRouter(r *gin.Engine) {
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)
		}

		chat := api.Group("/chat")
		{
			chat.POST("/listChat", handler.ListChat)
			chat.Use(jwt.JWTAuth(consts.JWT_SECRET_KEY))
			chat.GET("/ws", handler.Chat)

		}
		service := api.Group("/service")
		{
			service.Use(jwt.JWTAuth(consts.JWT_SECRET_KEY))
			service.POST("/createService", handler.CreateService)
		}
	}
}
